package cn.intotw.rdcj.admin.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by Chenxiang
 *
 * @generator: IntelliJ IDEA
 * @description: 登录控制器
 * @project: rdcj
 * @package: cn.intotw.rdcj.admin.controller
 * @date: 2021年06月01日 14时41分
 */
@Controller
@RequestMapping("/admin")
public class LoginController {
    @PostMapping("/login")
    public String login(@RequestParam("username") String username,
                        @RequestParam("password") String password){
        Subject subject= SecurityUtils.getSubject();
        UsernamePasswordToken token=new UsernamePasswordToken("732260312505470982","a-s-d-f-g-h-j-k");
        token.setRememberMe(true);
        subject.login(token);

        return "redirect:/html/index.html";
    }
}
